home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Shape Smash / shape-smash.swf / scripts / mochi / as3 / MochiEvents.as < prev    next >
Encoding:
Text File  |  2010-05-14  |  3.5 KB  |  122 lines

  1. package mochi.as3
  2. {
  3.    import flash.display.MovieClip;
  4.    
  5.    public class MochiEvents
  6.    {
  7.       private static var gameStart:Number;
  8.       
  9.       private static var levelStart:Number;
  10.       
  11.       public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
  12.       
  13.       public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
  14.       
  15.       public static const ALIGN_TOP:String = "ALIGN_T";
  16.       
  17.       public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
  18.       
  19.       public static const ALIGN_LEFT:String = "ALIGN_L";
  20.       
  21.       public static const ALIGN_CENTER:String = "ALIGN_C";
  22.       
  23.       public static const ALIGN_RIGHT:String = "ALIGN_R";
  24.       
  25.       public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
  26.       
  27.       public static const ALIGN_BOTTOM:String = "ALIGN_B";
  28.       
  29.       public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
  30.       
  31.       public static const FORMAT_SHORT:String = "ShortForm";
  32.       
  33.       public static const FORMAT_LONG:String = "LongForm";
  34.       
  35.       private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
  36.       
  37.       public function MochiEvents()
  38.       {
  39.          super();
  40.       }
  41.       
  42.       public static function addEventListener(param1:String, param2:Function) : void
  43.       {
  44.          _dispatcher.addEventListener(param1,param2);
  45.       }
  46.       
  47.       public static function _vc41() : void
  48.       {
  49.          var _loc1_:Number = NaN;
  50.          _loc1_ = new Date().time - levelStart;
  51.          trigger("end_level",{"time":_loc1_});
  52.       }
  53.       
  54.       public static function _vl688(param1:MovieClip, param2:Object) : void
  55.       {
  56.          var _loc3_:Object = null;
  57.          var _loc4_:Object = null;
  58.          _loc3_ = {};
  59.          for(_loc4_ in param2)
  60.          {
  61.             _loc3_[_loc4_] = param2[_loc4_];
  62.          }
  63.          _loc3_._cn696 = param1;
  64.          MochiServices.send("events_setNotifications",_loc3_,null,null);
  65.       }
  66.       
  67.       public static function _xc131() : void
  68.       {
  69.          gameStart = new Date().time;
  70.          trigger("start_game");
  71.       }
  72.       
  73.       public static function triggerEvent(param1:String, param2:Object) : void
  74.       {
  75.          _dispatcher.triggerEvent(param1,param2);
  76.       }
  77.       
  78.       public static function _gq31() : void
  79.       {
  80.          var _loc1_:Number = NaN;
  81.          _loc1_ = new Date().time - gameStart;
  82.          trigger("end_game",{"time":_loc1_});
  83.       }
  84.       
  85.       public static function removeEventListener(param1:String, param2:Function) : void
  86.       {
  87.          _dispatcher.removeEventListener(param1,param2);
  88.       }
  89.       
  90.       public static function _bk630() : void
  91.       {
  92.          levelStart = new Date().time;
  93.          trigger("start_level");
  94.       }
  95.       
  96.       public static function _dr706(param1:String) : void
  97.       {
  98.          MochiServices.send("events_beginSession",{"achievementID":param1},null,null);
  99.       }
  100.       
  101.       public static function trigger(param1:String, param2:Object = null) : void
  102.       {
  103.          if(param2 == null)
  104.          {
  105.             param2 = {};
  106.          }
  107.          else if(param2["kind"] != undefined)
  108.          {
  109.             trace("WARNING: optional arguements package contains key \'id\', it will be overwritten");
  110.             param2["kind"] = param1;
  111.          }
  112.          MochiServices.send("events_triggerEvent",{"eventObject":param2},null,null);
  113.       }
  114.       
  115.       public static function _rm99() : String
  116.       {
  117.          return MochiServices._rm99();
  118.       }
  119.    }
  120. }
  121.  
  122.